/* Sentinel - IRC Statistical and Operator Services
** capab.c - Support functions and tables for CAPAB
**
** Copyright W. Campbell and others.  See README for more details
** Some code Copyright: Jonathan George, Kai Seidler, ircd-hybrid Team,
**                      IRCnet IRCD developers.
**
** $Id: capab.c 7 2010-02-01 19:17:42Z dubkat $
*/

#include "stats.h"
#include "struct.h"
#include "proto.h"

static char *capab_list[] =
  {
#if defined(IRCD_HYB6) || defined(IRCD_HYB7) || defined(IRCD_HYBSVS)
    "QS",
#endif
#if defined(IRCD_HYB7) || defined(IRCD_HYBSVS)
    "EOB",
    "HOPS",
#endif
#if defined(IRCD_HYBSVS)
    "HYBSVS",
    "SVS",
    "SVSNICK",
    "SVSMODE",
#endif
#if defined(IRCD_BAHAMUT)
    "TS3",
    "NOQUIT",
    "BURST",
    "UNCONNECT",
    "SSJOIN",
    "TSMODE",
    "NICKIP",
#endif
#if defined(SUPPORT_HOSTSERV)
    "SVSHOST",
#endif
#ifdef USE_OPERSPY
    "ENCAP",
#endif
#if defined(LISTSERV) && !defined(IRCD_BAHAMUT)
    "TB",
    "TBURST",
#endif
    NULL
  };

char *generate_capab_string(void)
{
  static char cap_buf[BUFSIZE];
  int i;

  cap_buf[0] = '\0';

  for (i = 0; capab_list[i] != NULL; i++)
  {
    if (cap_buf[0] == '\0')
    {
      strlcat(cap_buf, capab_list[i], BUFSIZE);
    }
    else
    {
      strlcat(cap_buf, " ", BUFSIZE);
      strlcat(cap_buf, capab_list[i], BUFSIZE);
    }
  }

  return cap_buf;
}

